home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / src-server / wc_FileSB.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-04  |  20.7 KB  |  533 lines

  1. /* -*-C-*-
  2. ********************************************************************************
  3. *
  4. * File:         wc_FileSB.c
  5. * RCS:          $Header: wc_FileSB.c,v 1.6 91/03/14 03:14:38 mayer Exp $
  6. * Description:  XM_FILE_SELECTION_BOX_WIDGET_CLASS
  7. * Author:       Niels Mayer, HPLabs
  8. * Created:      Fri Oct 27 22:29:33 1989
  9. * Modified:     Thu Oct  3 21:46:03 1991 (Niels Mayer) mayer@hplnpm
  10. * Language:     C
  11. * Package:      N/A
  12. * Status:       Experimental (Do Not Distribute)
  13. * Status:       X11r5 contrib tape release
  14. *
  15. * WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  16. * XLISP version 2.1, Copyright (c) 1989, by David Betz.
  17. *
  18. * Permission to use, copy, modify, distribute, and sell this software and its
  19. * documentation for any purpose is hereby granted without fee, provided that
  20. * the above copyright notice appear in all copies and that both that
  21. * copyright notice and this permission notice appear in supporting
  22. * documentation, and that the name of Hewlett-Packard and David Betz not be
  23. * used in advertising or publicity pertaining to distribution of the software
  24. * without specific, written prior permission.  Hewlett-Packard and David Betz
  25. * make no representations about the suitability of this software for any
  26. * purpose. It is provided "as is" without express or implied warranty.
  27. *
  28. * HEWLETT-PACKARD AND DAVID BETZ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
  29. * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  30. * IN NO EVENT SHALL HEWLETT-PACKARD NOR DAVID BETZ BE LIABLE FOR ANY SPECIAL,
  31. * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  32. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  33. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  34. * PERFORMANCE OF THIS SOFTWARE.
  35. *
  36. * See ./winterp/COPYRIGHT for information on contacting the authors.
  37. * Please send modifications, improvements and bugfixes to mayer@hplabs.hp.com
  38. * Post XLISP-specific questions/information to the newsgroup comp.lang.lisp.x
  39. *
  40. ********************************************************************************
  41. */
  42. static char rcs_identity[] = "@(#)$Header: wc_FileSB.c,v 1.6 91/03/14 03:14:38 mayer Exp $";
  43.  
  44. #include <stdio.h>
  45. #include <Xm/Xm.h>
  46. #include <Xm/FileSB.h>
  47. #include "winterp.h"
  48. #include "user_prefs.h"
  49. #include "xlisp/xlisp.h"
  50. #include "w_funtab.h"
  51. #include "w_XmString.h"
  52.  
  53.  
  54. extern Widget Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(); /* w_classes.c */
  55.  
  56.  
  57. /*****************************************************************************
  58.  * (send XM_FILE_SELECTION_BOX_WIDGET_CLASS :new 
  59.  *                           [:managed/:unmanaged]
  60.  *                           [:dialog]
  61.  *                           [<name>]
  62.  *                           <parent> 
  63.  *                           [:XMN_<arg1> <val1>]
  64.  *                           [. . .             ]
  65.  *                           [:XMN_<argN> <valN>])
  66.  *
  67.  * The optional keyword submessage :managed will cause a subsequent call
  68.  * to XtManageChild(). If the submessage :unmanaged is present, or no
  69.  * submessage, then XtManageChild() won't be called, and the resulting
  70.  * widget will be returned unmanaged.
  71.  *
  72.  * (send XM_FILE_SELECTION_BOX_WIDGET_CLASS :new ...)
  73.  *   --> XmCreateFileSelectionBox();
  74.  * (send XM_FILE_SELECTION_BOX_WIDGET_CLASS :new :dialog ...)
  75.  *   --> XmCreateFileSelectionDialog();
  76.  ****************************************************************************/
  77. LVAL Xm_File_Selection_Box_Widget_Class_Method_ISNEW()
  78. {
  79.   extern ArgList Wres_Get_LispArglist(); /* from w_resources.c */
  80.   extern void    Wres_Free_C_Arglist_Data(); /* from w_resources.c */
  81.   extern LVAL k_managed, k_unmanaged, k_dialog;
  82.   LVAL self, o_parent;
  83.   char* name;
  84.   Boolean managed_p, dialog_p;
  85.   Widget widget_id, parent_widget_id;
  86.  
  87.   self = xlgaobject();        /* NOTE: xlobj.c:clnew() returns an OBJECT; if this method
  88.                    returns successfully, it will return a WIDGETOBJ */
  89.  
  90.   /* get optional managed/unmanaged arg */
  91.   if (moreargs() && ((*xlargv == k_managed) || (*xlargv == k_unmanaged)))
  92.     managed_p = (nextarg() == k_managed);
  93.   else
  94.     managed_p = FALSE;        /* by default don't call XtManageChild() */
  95.  
  96.   /* get optional :dialog arg */
  97.   if (moreargs() && (*xlargv == k_dialog)) {
  98.     nextarg();
  99.     dialog_p = TRUE;
  100.   }
  101.   else
  102.     dialog_p = FALSE;        /* by default, we don't want a dialog widget */
  103.  
  104.   /* get optional <name> arg */
  105.   if (moreargs() && (stringp(*xlargv)))
  106.     name = (char*) getstring(nextarg());
  107.   else
  108.     name = "";            /* default name */
  109.  
  110.   /* get required <parent> widget-object arg */
  111.   parent_widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&o_parent);
  112.  
  113.   /*
  114.    * Store the widget object <self> in the XmNuserData resource on the
  115.    * widget. This will allow us to retrieve the widget object from Xtoolkit
  116.    * functions returning widget ID's without having to keep around a table
  117.    * of widgetID-->widget-objects.
  118.    */
  119.    ARGLIST_RESET(); ARGLIST_ADD(XmNuserData, (XtArgVal) self); 
  120.  
  121.   if (moreargs()) {        /* if there are more arguments, */
  122.     Cardinal xt_numargs;    /* then we have some extra widget resources to set */
  123.     ArgList xt_arglist = Wres_Get_LispArglist(self, parent_widget_id, ARGLIST(), &xt_numargs);
  124.     if (dialog_p)
  125.       widget_id = XmCreateFileSelectionDialog(parent_widget_id, name, xt_arglist, xt_numargs);
  126.     else
  127.       widget_id = XmCreateFileSelectionBox(parent_widget_id, name, xt_arglist, xt_numargs);
  128.     Wres_Free_C_Arglist_Data();
  129.   }
  130.   else 
  131.     if (dialog_p)
  132.       widget_id = XmCreateFileSelectionDialog(parent_widget_id, name, ARGLIST());
  133.     else
  134.       widget_id = XmCreateFileSelectionBox(parent_widget_id, name, ARGLIST());
  135.  
  136.   Wcls_Initialize_WIDGETOBJ(self, widget_id);
  137.  
  138.   if (managed_p)
  139.     XtManageChild(widget_id);
  140.   
  141. #ifdef DEBUG_WINTERP_1
  142.   Wcls_Print_WidgetObj_Info(self);
  143. #endif
  144.   return (self);
  145. }
  146.  
  147.  
  148. /******************************************************************************
  149.  * typedef struct
  150.  * {
  151.  *     int reason;
  152.  *     XEvent    *event;
  153.  *     XmString    value;
  154.  *     int    length;
  155.  *     XmString    mask;
  156.  *     int    mask_length;
  157.  *     XmString    dir ;             -- THIS FIELD EXISTS ONLY IN MOTIF 1.1
  158.  *     int    dir_length ;     -- THIS FIELD EXISTS ONLY IN MOTIF 1.1
  159.  *     XmString pattern ;        -- THIS FIELD EXISTS ONLY IN MOTIF 1.1
  160.  *     int    pattern_length ; -- THIS FIELD EXISTS ONLY IN MOTIF 1.1
  161.  * } XmFileSelectionBoxCallbackStruct;
  162.  ******************************************************************************/
  163. static LVAL s_CALLBACK_MASK, s_CALLBACK_MASK_LENGTH;
  164. #ifdef WINTERP_MOTIF_11
  165. static LVAL s_CALLBACK_DIR, s_CALLBACK_DIR_LENGTH, s_CALLBACK_PATTERN, s_CALLBACK_PATTERN_LENGTH;
  166. #endif                /* WINTERP_MOTIF_11 */
  167. static void Lexical_Bindings_For_XmFileSelectionBoxCallbackStruct(bindings_list, lexical_env, cd, o_widget)
  168.      LVAL      bindings_list;    /* a list of symbols to which values from XmFileSelectionBoxCallbackStruct are bound */
  169.      LVAL      lexical_env;        
  170.      XmFileSelectionBoxCallbackStruct* cd;
  171.      LVAL      o_widget;    /* XLTYPE_WIDGETOBJ */
  172. {
  173.   extern LVAL s_CALLBACK_WIDGET, s_CALLBACK_REASON, s_CALLBACK_XEVENT, s_CALLBACK_VALUE, s_CALLBACK_LENGTH; /* w_callbacks.c */
  174.   extern LVAL Wcb_Get_Callback_Reason_Symbol();    /* w_callbacks.c */
  175.   register LVAL s_bindname;
  176.  
  177.   for ( ; consp(bindings_list); bindings_list = cdr(bindings_list)) {
  178.  
  179.     s_bindname = car(bindings_list);
  180.  
  181.     if (s_bindname == s_CALLBACK_WIDGET) {
  182.       xlpbind(s_bindname, o_widget, lexical_env);
  183.     }
  184.     else if (s_bindname == s_CALLBACK_REASON) {
  185.       xlpbind(s_bindname, Wcb_Get_Callback_Reason_Symbol(cd->reason), lexical_env);
  186.     }
  187.     else if (s_bindname == s_CALLBACK_XEVENT) {
  188.       xlpbind(s_bindname, (cd->event) ? cv_xevent(cd->event) : NIL, lexical_env);
  189.     }
  190.     else if (s_bindname == s_CALLBACK_VALUE) {
  191.       xlpbind(s_bindname, (cd->value) ? cv_xmstring(XmStringCopy(cd->value)) : NIL, lexical_env);
  192.     }
  193.     else if (s_bindname == s_CALLBACK_LENGTH) {
  194.       xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->length), lexical_env);
  195.     }
  196.     else if (s_bindname == s_CALLBACK_MASK) {
  197.       xlpbind(s_bindname, (cd->mask) ? cv_xmstring(XmStringCopy(cd->mask)) : NIL, lexical_env);
  198.     }
  199.     else if (s_bindname == s_CALLBACK_MASK_LENGTH) {
  200.       xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->mask_length), lexical_env);
  201.     }
  202. #ifdef WINTERP_MOTIF_11
  203.     else if (s_bindname == s_CALLBACK_DIR) {
  204.       xlpbind(s_bindname, (cd->mask) ? cv_xmstring(XmStringCopy(cd->dir)) : NIL, lexical_env);
  205.     }
  206.     else if (s_bindname == s_CALLBACK_DIR_LENGTH) {
  207.       xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->dir_length), lexical_env);
  208.     }
  209.     else if (s_bindname == s_CALLBACK_PATTERN) {
  210.       xlpbind(s_bindname, (cd->mask) ? cv_xmstring(XmStringCopy(cd->pattern)) : NIL, lexical_env);
  211.     }
  212.     else if (s_bindname == s_CALLBACK_PATTERN_LENGTH) {
  213.       xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->pattern_length), lexical_env);
  214.     }
  215. #endif                /* WINTERP_MOTIF_11 */
  216.     else {
  217.       extern char temptext[];    /* from winterp.c */
  218.       sprintf(temptext,
  219. #ifdef WINTERP_MOTIF_11
  220.           "Unknown binding name in XmFileSelectionBoxCallbackStruct callback evaluator. Valid symbols are [%s %s %s %s %s %s %s %s %s %s %s].",
  221. #else
  222.           "Unknown binding name in XmFileSelectionBoxCallbackStruct callback evaluator. Valid symbols are [%s %s %s %s %s %s %s].",
  223. #endif                /* WINTERP_MOTIF_11 */
  224.  
  225.           (char*) getstring(getpname(s_CALLBACK_WIDGET)),
  226.           (char*) getstring(getpname(s_CALLBACK_REASON)),
  227.           (char*) getstring(getpname(s_CALLBACK_XEVENT)),
  228.           (char*) getstring(getpname(s_CALLBACK_VALUE)),
  229.           (char*) getstring(getpname(s_CALLBACK_LENGTH)),
  230. #ifdef WINTERP_MOTIF_11
  231.           (char*) getstring(getpname(s_CALLBACK_DIR)),
  232.           (char*) getstring(getpname(s_CALLBACK_DIR_LENGTH)),
  233.           (char*) getstring(getpname(s_CALLBACK_PATTERN)),
  234.           (char*) getstring(getpname(s_CALLBACK_PATTERN_LENGTH)),
  235. #endif                /* WINTERP_MOTIF_11 */
  236.           (char*) getstring(getpname(s_CALLBACK_MASK)),
  237.           (char*) getstring(getpname(s_CALLBACK_MASK_LENGTH)));
  238.       xlerror(temptext, s_bindname);
  239.     }
  240.   }
  241. }
  242.  
  243.  
  244. /******************************************************************************
  245.  * This is called indirectly via XtAddCallback() for callbacks returning
  246.  * an XmFileSelectionBoxCallbackStruct as call_data.
  247.  ******************************************************************************/
  248. static void XmFileSelectionBoxCallbackStruct_Callbackproc(widget, client_data, call_data)
  249.      Widget    widget;
  250.      XtPointer client_data;
  251.      XtPointer call_data;
  252. {
  253.   extern void Wcb_Meta_Callbackproc();    /* w_callbacks.c */
  254.  
  255.   Wcb_Meta_Callbackproc(client_data, call_data,
  256.             Lexical_Bindings_For_XmFileSelectionBoxCallbackStruct,
  257.             NULL);
  258. }
  259.  
  260.  
  261. /******************************************************************************
  262.  * Same as WIDGET_CLASS's :add_callback method except that this understands
  263.  * how to get values from the XmFileSelectionBoxCallbackStruct.
  264.  * Specifying one or more of the following symbols in the callback bindings 
  265.  * list will bind that symbol's value in the lexical environment of the callback:
  266.  * CALLBACK_WIDGET
  267.  * CALLBACK_REASON
  268.  * CALLBACK_XEVENT
  269.  * CALLBACK_VALUE
  270.  * CALLBACK_LENGTH
  271.  * CALLBACK_MASK
  272.  * CALLBACK_MASK_LENGTH
  273.  * CALLBACK_DIR         -- ONLY IN MOTIF 1.1
  274.  * CALLBACK_DIR_LENGTH        -- ONLY IN MOTIF 1.1
  275.  * CALLBACK_PATTERN        -- ONLY IN MOTIF 1.1
  276.  * CALLBACK_PATTERN_LENGTH    -- ONLY IN MOTIF 1.1
  277.  ******************************************************************************/
  278. LVAL Xm_File_Selection_Box_Widget_Class_Method_ADD_CALLBACK()
  279. {
  280.   extern LVAL Wcb_Meta_Method_Add_Callback(); /* w_callbacks.c */
  281.  
  282.   return (Wcb_Meta_Method_Add_Callback(XmFileSelectionBoxCallbackStruct_Callbackproc, FALSE));
  283. }
  284.  
  285.  
  286. /******************************************************************************
  287.  * Same as WIDGET_CLASS's :set_callback method except that this understands
  288.  * how to get values from the XmFileSelectionBoxCallbackStruct.
  289.  * Specifying one or more of the following symbols in the callback bindings 
  290.  * list will bind that symbol's value in the lexical environment of the callback:
  291.  * CALLBACK_WIDGET
  292.  * CALLBACK_REASON
  293.  * CALLBACK_XEVENT
  294.  * CALLBACK_VALUE
  295.  * CALLBACK_LENGTH
  296.  * CALLBACK_MASK
  297.  * CALLBACK_MASK_LENGTH
  298.  * CALLBACK_DIR         -- ONLY IN MOTIF 1.1
  299.  * CALLBACK_DIR_LENGTH        -- ONLY IN MOTIF 1.1
  300.  * CALLBACK_PATTERN        -- ONLY IN MOTIF 1.1
  301.  * CALLBACK_PATTERN_LENGTH    -- ONLY IN MOTIF 1.1
  302.  ******************************************************************************/
  303. LVAL Xm_File_Selection_Box_Widget_Class_Method_SET_CALLBACK()
  304. {
  305.   extern LVAL Wcb_Meta_Method_Add_Callback(); /* w_callbacks.c */
  306.  
  307.   return (Wcb_Meta_Method_Add_Callback(XmFileSelectionBoxCallbackStruct_Callbackproc, TRUE));
  308. }
  309.  
  310.  
  311. /******************************************************************************
  312.  * (send <fileselboxwidget> :GET_CHILD <child_sym>)
  313.  * This method returns a WIDGETOBJ corresponding to one of
  314.  * <fileselboxwidget> children. <child_sym> can be one of:
  315.  *    :DIALOG_WORK_AREA
  316.  *    :DIALOG_SEPARATOR
  317.  *    :DIALOG_APPLY_BUTTON
  318.  *    :DIALOG_CANCEL_BUTTON
  319.  *    :DIALOG_DEFAULT_BUTTON
  320.  *    :DIALOG_FILTER_LABEL
  321.  *    :DIALOG_FILTER_TEXT
  322.  *    :DIALOG_HELP_BUTTON
  323.  *    :DIALOG_LIST
  324.  *    :DIALOG_LIST_LABEL
  325.  *    :DIALOG_OK_BUTTON
  326.  *    :DIALOG_SELECTION_LABEL
  327.  *    :DIALOG_TEXT
  328.  *    :DIALOG_DIR_LIST    -- EXISTS ONLY IN MOTIF 1.1
  329.  *    :DIALOG_DIR_LIST_LABEL    -- EXISTS ONLY IN MOTIF 1.1
  330.  *
  331.  *  Widget XmFileSelectionBoxGetChild (fs, which)
  332.  *  Widget fs;             -- SelectionBox widget 
  333.  *  unsigned char which; --  which child
  334.  ******************************************************************************/
  335. LVAL Xm_File_Selection_Box_Widget_Class_Method_GET_CHILD()
  336. {
  337.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ();
  338.   extern LVAL s_XmDIALOG_FILTER_LABEL, s_XmDIALOG_FILTER_TEXT,
  339. #ifdef WINTERP_MOTIF_11
  340.   s_XmDIALOG_DIR_LIST, s_XmDIALOG_DIR_LIST_LABEL,
  341. #endif                /* WINTERP_MOTIF_11 */
  342.   s_XmDIALOG_LIST, s_XmDIALOG_LIST_LABEL, s_XmDIALOG_SELECTION_LABEL, 
  343.   s_XmDIALOG_WORK_AREA, s_XmDIALOG_TEXT, s_XmDIALOG_SEPARATOR,
  344.   s_XmDIALOG_OK_BUTTON, s_XmDIALOG_APPLY_BUTTON, s_XmDIALOG_CANCEL_BUTTON,
  345.   s_XmDIALOG_HELP_BUTTON, s_XmDIALOG_DEFAULT_BUTTON;
  346.   LVAL self, lval_child;
  347.   Widget widget_id;
  348.   unsigned char child;
  349.  
  350.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  351.   lval_child = xlgasymbol();
  352.   xllastarg();
  353.   
  354.   if (lval_child == s_XmDIALOG_FILTER_LABEL)
  355.     child = XmDIALOG_FILTER_LABEL;
  356.   else if (lval_child == s_XmDIALOG_FILTER_TEXT)
  357.     child = XmDIALOG_FILTER_TEXT;
  358. #ifdef WINTERP_MOTIF_11
  359.   else if (lval_child == s_XmDIALOG_DIR_LIST)
  360.     child = XmDIALOG_DIR_LIST;
  361.   else if (lval_child == s_XmDIALOG_DIR_LIST_LABEL)
  362.     child = XmDIALOG_DIR_LIST_LABEL;
  363. #endif                /* WINTERP_MOTIF_11 */
  364.   /* the following are from the selection box widget */
  365.   else if (lval_child == s_XmDIALOG_LIST)
  366.     child = XmDIALOG_LIST;
  367.   else if (lval_child == s_XmDIALOG_LIST_LABEL)
  368.     child = XmDIALOG_LIST_LABEL;
  369.   else if (lval_child == s_XmDIALOG_SELECTION_LABEL)
  370.     child = XmDIALOG_SELECTION_LABEL;
  371.   else if (lval_child == s_XmDIALOG_WORK_AREA)
  372.     child = XmDIALOG_WORK_AREA;
  373.   else if (lval_child == s_XmDIALOG_TEXT)
  374.     child = XmDIALOG_TEXT;
  375.   else if (lval_child == s_XmDIALOG_SEPARATOR)
  376.     child = XmDIALOG_SEPARATOR;
  377.   else if (lval_child == s_XmDIALOG_OK_BUTTON)
  378.     child = XmDIALOG_OK_BUTTON;
  379.   else if (lval_child == s_XmDIALOG_APPLY_BUTTON)
  380.     child = XmDIALOG_APPLY_BUTTON;
  381.   else if (lval_child == s_XmDIALOG_CANCEL_BUTTON)
  382.     child = XmDIALOG_CANCEL_BUTTON; 
  383.   else if (lval_child == s_XmDIALOG_HELP_BUTTON)
  384.     child = XmDIALOG_HELP_BUTTON;
  385.   else if (lval_child == s_XmDIALOG_DEFAULT_BUTTON)
  386.     child =XmDIALOG_DEFAULT_BUTTON;
  387.   else 
  388.     xlerror("FILE_SELECTION_BOX_WIDGET_CLASS method :GET_CHILD -- unknown child type.", lval_child);
  389.  
  390.   return (Wcls_WidgetID_To_WIDGETOBJ(XmFileSelectionBoxGetChild(widget_id, child))); 
  391. }
  392.  
  393.  
  394. /******************************************************************************
  395.  * (send <fileselboxwidget> :DO_SEARCH [<dirmask>])
  396.  * this method initiates a directory search. The search will be according to 
  397.  * the string or XmString <dirmask>. If <dirmask> is NIL or not supplied, then
  398.  * the search will use the current directory mask. This method returns <dirmask>
  399.  * as an XmString.
  400.  *
  401.  * void XmFileSelectionDoSearch(fs, dirmask)
  402.  * Widget fs;
  403.  * XmString   dirmask;
  404.  ******************************************************************************/
  405. LVAL Xm_File_Selection_Box_Widget_Class_Method_DO_SEARCH()
  406. {
  407.   LVAL self, lval_dirmask;
  408.   Widget widget_id;
  409.   XmString dirmask;
  410.   extern XmString Get_String_or_XmString_Arg_Returning_XmString(); /* w_XmString.c */
  411.  
  412.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  413.   if (moreargs() && (*xlargv))    /* get a non-NIL <dirmask> argument */
  414.     dirmask = Get_String_or_XmString_Arg_Returning_XmString(&lval_dirmask);
  415.   else if (moreargs()) {    /* else skip a NIL <dirmask> argument */
  416.     nextarg();
  417.     dirmask = NULL;
  418.   }
  419.   else                /* else no <dirmask> argument */
  420.     dirmask = NULL;
  421.   xllastarg();
  422.   
  423.   XmFileSelectionDoSearch(widget_id, dirmask);
  424.   
  425.   return (lval_dirmask);
  426. }
  427.  
  428.  
  429. #ifdef WINTERP_MOTIF_11
  430. /******************************************************************************
  431.  * (send <fileselboxwidget> :GET_DIR_LIST_ITEMS)
  432.  *     ==> returns an array of XmStrings.
  433.  *
  434.  * This retrieves the XmFileSelectionBox widget resources XmNdirListItems and
  435.  * XmNdirListItemCount from <fileselboxwidget> and returns an array of XmStrings
  436.  * representing the items in the directory list.
  437.  *******************************************************************************/
  438. LVAL Xm_File_Selection_Box_Widget_Class_Method_GET_DIR_LIST_ITEMS()
  439. {
  440.   LVAL self;
  441.   Widget widget_id;
  442.   XmStringTable xmstrtab;
  443.   int        xmstrtab_size;
  444.  
  445.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  446.   xllastarg();
  447.  
  448.   ARGLIST_RESET();
  449.   ARGLIST_ADD(XmNdirListItems, &xmstrtab);
  450.   ARGLIST_ADD(XmNdirListItemCount, &xmstrtab_size);
  451.   XtGetValues(widget_id, ARGLIST());
  452.  
  453.   return (Wxms_XmStringTable_To_Lisp_Vector(xmstrtab, xmstrtab_size));
  454. }
  455.  
  456.  
  457. /******************************************************************************
  458.  * (send <fileselboxwidget>  :GET_FILE_LIST_ITEMS)
  459.  *     ==> returns an array of XmStrings
  460.  *
  461.  * This retrieves the XmFileSelectionBox widget resources XmNfileListItems and
  462.  * XmNfileListItemCount from <fileselboxwidget> and returns an array of XmStrings
  463.  * representing the items in the file list.
  464.  *******************************************************************************/
  465. LVAL Xm_File_Selection_Box_Widget_Class_Method_GET_FILE_LIST_ITEMS()
  466. {
  467.   LVAL self;
  468.   Widget widget_id;
  469.   XmStringTable xmstrtab;
  470.   int        xmstrtab_size;
  471.  
  472.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  473.   xllastarg();
  474.  
  475.   ARGLIST_RESET();
  476.   ARGLIST_ADD(XmNfileListItems, &xmstrtab);
  477.   ARGLIST_ADD(XmNfileListItemCount, &xmstrtab_size);
  478.   XtGetValues(widget_id, ARGLIST());
  479.  
  480.   return (Wxms_XmStringTable_To_Lisp_Vector(xmstrtab, xmstrtab_size));
  481. }
  482. #endif                /* WINTERP_MOTIF_11 */
  483.  
  484.  
  485. /******************************************************************************
  486.  *
  487.  ******************************************************************************/
  488. Wc_FileSB_Init()
  489. {
  490.   LVAL o_XM_FILE_SELECTION_BOX_WIDGET_CLASS;
  491.   extern LVAL Wcls_Create_Subclass_Of_WIDGET_CLASS(); /* w_classes.c */
  492.   extern      xladdmsg();    /* from xlobj.c */
  493.  
  494.   o_XM_FILE_SELECTION_BOX_WIDGET_CLASS =
  495.     Wcls_Create_Subclass_Of_WIDGET_CLASS("XM_FILE_SELECTION_BOX_WIDGET_CLASS",
  496.                      xmFileSelectionBoxWidgetClass);
  497.  
  498.   /* a special :isnew method on this class allows for the creation of this
  499.      widget in a popup dialog if the submessage keyword :dialog is given ... */
  500.   xladdmsg(o_XM_FILE_SELECTION_BOX_WIDGET_CLASS, ":ISNEW", 
  501.        FTAB_Xm_File_Selection_Box_Widget_Class_Method_ISNEW);
  502.  
  503.   xladdmsg(o_XM_FILE_SELECTION_BOX_WIDGET_CLASS, ":ADD_CALLBACK",
  504.            FTAB_Xm_File_Selection_Box_Widget_Class_Method_ADD_CALLBACK);
  505.  
  506.   xladdmsg(o_XM_FILE_SELECTION_BOX_WIDGET_CLASS, ":SET_CALLBACK",
  507.            FTAB_Xm_File_Selection_Box_Widget_Class_Method_SET_CALLBACK);
  508.  
  509.   xladdmsg(o_XM_FILE_SELECTION_BOX_WIDGET_CLASS, ":GET_CHILD",
  510.            FTAB_Xm_File_Selection_Box_Widget_Class_Method_GET_CHILD);
  511.  
  512.   xladdmsg(o_XM_FILE_SELECTION_BOX_WIDGET_CLASS, ":DO_SEARCH",
  513.        FTAB_Xm_File_Selection_Box_Widget_Class_Method_DO_SEARCH);
  514.  
  515. #ifdef WINTERP_MOTIF_11
  516.   xladdmsg(o_XM_FILE_SELECTION_BOX_WIDGET_CLASS, ":GET_DIR_LIST_ITEMS",
  517.        FTAB_Xm_File_Selection_Box_Widget_Class_Method_GET_DIR_LIST_ITEMS);
  518.  
  519.   xladdmsg(o_XM_FILE_SELECTION_BOX_WIDGET_CLASS, ":GET_FILE_LIST_ITEMS",
  520.        FTAB_Xm_File_Selection_Box_Widget_Class_Method_GET_FILE_LIST_ITEMS);
  521. #endif                /* WINTERP_MOTIF_11 */
  522.  
  523.   s_CALLBACK_MASK           = xlenter("CALLBACK_MASK");
  524.   s_CALLBACK_MASK_LENGTH    = xlenter("CALLBACK_MASK_LENGTH");
  525. #ifdef WINTERP_MOTIF_11
  526.   s_CALLBACK_DIR            = xlenter("CALLBACK_DIR");
  527.   s_CALLBACK_DIR_LENGTH     = xlenter("CALLBACK_DIR_LENGTH");
  528.   s_CALLBACK_PATTERN        = xlenter("CALLBACK_PATTERN");
  529.   s_CALLBACK_PATTERN_LENGTH = xlenter("CALLBACK_PATTERN_LENGTH");
  530. #endif                /* WINTERP_MOTIF_11 */
  531. }
  532.